package com.adou.d17;

import java.io.FileReader;
import java.util.Properties;
import java.util.Set;

public class PropertiesTest1 {
    public static void main(String[] args) throws Exception {
        Properties properties = new Properties();
        properties.load(new FileReader("d1-helloword-app\\src\\users.properties"));
        System.out.println(properties);

        // 2.根据键获取值
        System.out.println(properties.getProperty("admin"));

        // 3.遍历全部键
        final Set<String> names = properties.stringPropertyNames();
//        for (String name : names) {
//            System.out.println(name + " ==== " + properties.getProperty(name));
//        }

        // 4.lambda(推荐)
        properties.forEach((k,v)-> System.out.println(k + " ==== " + v));

    }
}
